<template>
  <div class="container">
    <data-view
      :propViewKey="strings.defaultIfBlank(propViewKey, 'device_work')"
      :propViewForm="propViewForm"
      :propIsTdesign="true"
      ref="dataView"
      :propAutoFetchData="false"
      :propFlowKey="propFlowKey"
      :propParam="{busType: propBusType}"
      :propViewFormTitle="cpPropViewFormTitle"
      :propHideColumns="cpPropHideColumns"
      :flowNodeListFilterFun="flowNodeListFilterFun"
      :flowButtonFilterFun="flowButtonFilterFun"
      :propInitData="propInitData"
      @extra-button-click="extraButtonClick"
    />
  </div>
</template>

<script>
export default {
  desc: '设备工作表-列表',
  props: ['propParameter', 'propFlowKey', 'propBusType', 'propViewForm', 'propViewKey', 'propFlowStatusIn', 'flowNodeListFilterFun', 'propInitData', 'flowButtonFilterFun'],
  mounted() {
    let wrapper = this.$newWrapper()
    wrapper.eq('bus_type', this.propBusType)
    if (this.propFlowStatusIn && this.propFlowStatusIn.length > 0) {
      wrapper.in('flow_status',this.propFlowStatusIn )
    }
    this.$refs.dataView.setQueryWrapper(wrapper)
  },

  data() {
    return {
    }
  },
  computed: {
    // 弹框标题
    cpPropViewFormTitle() {
      return this.utils.getDictLabel(this.propBusType, this.constCommon.dictType.deviceBusType, null, false) + '详情'
    },
    // 隐藏列
    cpPropHideColumns() {
      if (this.propBusType == this.constCommon.dictType.deviceBusTypeTransferDept) {
        return []
      }
      return ['deptNameTo']
    },
  },
  components: {
  },
  methods: {
    extraButtonClick(para) {
      let buttonKey = para.button.key
      if (buttonKey === 'execOld') { //执行折旧任务
        return
      }
    }
  }
}
</script>
